<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="code documentation and blog">
    <meta name="author" content="Brian Detering">
    <link rel="shortcut icon" href="favicon.ico">

    <title>Programming Doodles | jQuery Repeater</title>

    <link rel="stylesheet" type="text/css"
          href="http://briandetering.net//library/bootstrap-3.1.1-dist/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="http://briandetering.net//library/style.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<a href="https://github.com/DubFriend/jquery.repeater"><img
        style="position: absolute; top: 50px; right: 0; border: 0;"
        src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67"
        alt="Fork me on GitHub"
        data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png">
</a>
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="http://briandetering.net/">Programming Doodles</a>
        </div>
        <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Utilities <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="forminator">Forminator</a></li>
                        <li><a href="repeater">Repeater</a></li>
                        <li><a href="input-group">Input Group</a></li>
                        <li><a href="https://github.com/DubFriend/jquery.file-ajax">
                            <img width="16px" src="media/GitHub-Mark/GitHub-Mark/PNG/GitHub-Mark-32px.png"/>
                            jquery.file-ajax
                        </a></li>
                        <li><a href="https://github.com/DubFriend/Sequel">
                            <img width="16px" src="media/GitHub-Mark/GitHub-Mark/PNG/GitHub-Mark-32px.png"/> Sequel
                        </a></li>
                        <li><a href="https://github.com/DubFriend/nodesql">
                            <img width="16px" src="media/GitHub-Mark/GitHub-Mark/PNG/GitHub-Mark-32px.png"/> NodeSQL
                        </a></li>
                        <li><a href="https://github.com/DubFriend/imagery">
                            <img width="16px" src="media/GitHub-Mark/GitHub-Mark/PNG/GitHub-Mark-32px.png"/> Imagery
                        </a></li>
                        <li><a href="https://github.com/DubFriend/queryjs">
                            <img width="16px" src="media/GitHub-Mark/GitHub-Mark/PNG/GitHub-Mark-32px.png"/> QueryJS
                        </a></li>
                    </ul>
                </li>

                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Experiments <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <!-- <li><a href="phpIM">phpIM</a></li> -->
                        <li><a href="canvas-hexagonal-game-map">Canvas Game Map</a></li>
                    </ul>
                </li>

                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        General Stuff <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="chess">Chess</a></li>
                        <li><a href="gravitron">Gravitron</a></li>
                        <li><a href="graffiti-wall">Graffiti Wall</a></li>
                    </ul>
                </li>

            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Contact <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="mailto:bdeterin@gmail.com">
                            <span class="glyphicon glyphicon-envelope"></span>
                            Email
                        </a></li>
                        <li><a href="https://github.com/DubFriend">
                            <img width="16px" src="media/GitHub-Mark/GitHub-Mark/PNG/GitHub-Mark-32px.png"/> GitHub
                        </a></li>
                        <li><a href="https://www.linkedin.com/in/briandetering">
                            <img src="media/InBug-16px_0.png"/> LinkedIN
                        </a></li>
                    </ul>
                </li>
            </ul>
        </div><!--/.nav-collapse -->
    </div>
</div>
<div class="container">
    <div class="jumbotron">
        <h1>jQuery Repeater</h1>
        <p>
            An interface to add and remove a
            repeatable group of input elements.
        </p>
    </div>
    <div class="row">
        <div class="col-md-12">


            <p><a href="https://github.com/DubFriend/jquery.repeater">
                <img width="16px" src="media/GitHub-Mark/GitHub-Mark/PNG/GitHub-Mark-32px.png"/> See GitHub for full
                documentation.
            </a></p>


            <h3>Post Server Response</h3>
            <pre>{
    "car": [
        {
            "make": "volkswagon",
            "model": "Beetle"
        },
        {
            "make": "honda",
            "model": "Accord",
            "features": [
                "ac",
                "abs"
            ]
        }
    ]
}</pre>


            <br/>
            <h2>Default Configuration</h2>
            <br/>
            <pre>$repeater.repeater();</pre>
            <form method="POST" class="form-horizontal well" role="form">
                <fieldset>
                    <legend>Cars</legend>
                    <div class="repeater-default">
                        <div data-repeater-list="car">
                            <div data-repeater-item>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">Make</label>
                                    <div class="col-sm-2">
                                        <select name="make" class="form-control">
                                            <option value="volkswagon" selected>Volkswagon</option>
                                            <option value="honda">Honda</option>
                                            <option value="ford">Ford</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label">Model</label>
                                    <div class="col-sm-2">
                                        <input type="text" name="model" value="Beetle" class="form-control"/>
                                    </div>

                                    <div class="col-sm-4">
                                        <label class="checkbox-inline">
                                            <input type="checkbox" name="features" value="ac"/>
                                            Air Conditioning
                                        </label>

                                        <label class="checkbox-inline">
                                            <input type="checkbox" name="features" value="abs"/>
                                            Anti-Lock Brakes
                                        </label>
                                    </div>

                                    <div class="col-sm-2">
              <span data-repeater-delete class="btn btn-danger btn-sm">
                <span class="glyphicon glyphicon-remove"></span> Delete
              </span>
                                    </div>
                                </div>
                            </div>

                            <div data-repeater-item>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">Make</label>
                                    <div class="col-sm-2">
                                        <select name="make" class="form-control">
                                            <option value="volkswagon">Volkswagon</option>
                                            <option value="honda" selected>Honda</option>
                                            <option value="ford">Ford</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label">Model</label>
                                    <div class="col-sm-2">
                                        <input type="text" name="model" value="Accord" class="form-control"/>
                                    </div>

                                    <div class="col-sm-4">
                                        <label class="checkbox-inline">
                                            <input type="checkbox" name="features" value="ac" checked/>
                                            Air Conditioning
                                        </label>

                                        <label class="checkbox-inline">
                                            <input type="checkbox" name="features" value="abs" checked/>
                                            Anti-Lock Brakes
                                        </label>
                                    </div>

                                    <div class="col-sm-2">
              <span data-repeater-delete class="btn btn-danger btn-sm">
                <span class="glyphicon glyphicon-remove"></span> Delete
              </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-1 col-sm-11">
          <span data-repeater-create class="btn btn-info btn-md">
            <span class="glyphicon glyphicon-plus"></span> Add
          </span>
                            </div>
                        </div>

                        <hr/>

                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-1 col-sm-11">
                            <input type="submit" value="Submit" class="btn btn-primary btn-lg"/>
                        </div>
                    </div>
                </fieldset>
            </form>
            <br/>
            <h2>Custom Show/Hide Configuration</h2>
            <br/>
            <pre>
$repeater.repeater({
  show: function () {
    $(this).slideDown();
  },
  hide: function (remove) {
    if(confirm('Are you sure you want to remove this item?')) {
      $(this).slideUp(remove);
    }
  }
});
</pre>
            <form method="POST" class="form-horizontal well" role="form">
                <fieldset>
                    <legend>Cars</legend>
                    <div class="repeater-custom-show-hide">
                        <div data-repeater-list="car">
                            <div data-repeater-item>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">Make</label>
                                    <div class="col-sm-2">
                                        <select name="make" class="form-control">
                                            <option value="volkswagon" selected>Volkswagon</option>
                                            <option value="honda">Honda</option>
                                            <option value="ford">Ford</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label">Model</label>
                                    <div class="col-sm-2">
                                        <input type="text" name="model" value="Beetle" class="form-control"/>
                                    </div>

                                    <div class="col-sm-4">
                                        <label class="checkbox-inline">
                                            <input type="checkbox" name="features" value="ac"/>
                                            Air Conditioning
                                        </label>

                                        <label class="checkbox-inline">
                                            <input type="checkbox" name="features" value="abs"/>
                                            Anti-Lock Brakes
                                        </label>
                                    </div>

                                    <div class="col-sm-2">
              <span data-repeater-delete class="btn btn-danger btn-sm">
                <span class="glyphicon glyphicon-remove"></span> Delete
              </span>
                                    </div>
                                </div>
                            </div>

                            <div data-repeater-item>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">Make</label>
                                    <div class="col-sm-2">
                                        <select name="make" class="form-control">
                                            <option value="volkswagon">Volkswagon</option>
                                            <option value="honda" selected>Honda</option>
                                            <option value="ford">Ford</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label">Model</label>
                                    <div class="col-sm-2">
                                        <input type="text" name="model" value="Accord" class="form-control"/>
                                    </div>

                                    <div class="col-sm-4">
                                        <label class="checkbox-inline">
                                            <input type="checkbox" name="features" value="ac" checked/>
                                            Air Conditioning
                                        </label>

                                        <label class="checkbox-inline">
                                            <input type="checkbox" name="features" value="abs" checked/>
                                            Anti-Lock Brakes
                                        </label>
                                    </div>

                                    <div class="col-sm-2">
              <span data-repeater-delete class="btn btn-danger btn-sm">
                <span class="glyphicon glyphicon-remove"></span> Delete
              </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-1 col-sm-11">
          <span data-repeater-create class="btn btn-info btn-md">
            <span class="glyphicon glyphicon-plus"></span> Add
          </span>
                            </div>
                        </div>

                        <hr/>

                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-1 col-sm-11">
                            <input type="submit" value="Submit" class="btn btn-primary btn-lg"/>
                        </div>
                    </div>
                </fieldset>
            </form>
            <br/>
            <h2>Default Values</h2>
            <br/>
            <pre>
$repeater.repeater({
  defaultValues: {
    features: ['abs'],
    make: 'ford',
    model: 'Mustang'
  }
});
</pre>
            <form method="POST" class="form-horizontal well" role="form">
                <fieldset>
                    <legend>Cars</legend>
                    <div class="repeater-default-values">
                        <div data-repeater-list="car">
                            <div data-repeater-item>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">Make</label>
                                    <div class="col-sm-2">
                                        <select name="make" class="form-control">
                                            <option value="volkswagon" selected>Volkswagon</option>
                                            <option value="honda">Honda</option>
                                            <option value="ford">Ford</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label">Model</label>
                                    <div class="col-sm-2">
                                        <input type="text" name="model" value="Beetle" class="form-control"/>
                                    </div>

                                    <div class="col-sm-4">
                                        <label class="checkbox-inline">
                                            <input type="checkbox" name="features" value="ac"/>
                                            Air Conditioning
                                        </label>

                                        <label class="checkbox-inline">
                                            <input type="checkbox" name="features" value="abs"/>
                                            Anti-Lock Brakes
                                        </label>
                                    </div>

                                    <div class="col-sm-2">
              <span data-repeater-delete class="btn btn-danger btn-sm">
                <span class="glyphicon glyphicon-remove"></span> Delete
              </span>
                                    </div>
                                </div>
                            </div>

                            <div data-repeater-item>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">Make</label>
                                    <div class="col-sm-2">
                                        <select name="make" class="form-control">
                                            <option value="volkswagon">Volkswagon</option>
                                            <option value="honda" selected>Honda</option>
                                            <option value="ford">Ford</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label">Model</label>
                                    <div class="col-sm-2">
                                        <input type="text" name="model" value="Accord" class="form-control"/>
                                    </div>

                                    <div class="col-sm-4">
                                        <label class="checkbox-inline">
                                            <input type="checkbox" name="features" value="ac" checked/>
                                            Air Conditioning
                                        </label>

                                        <label class="checkbox-inline">
                                            <input type="checkbox" name="features" value="abs" checked/>
                                            Anti-Lock Brakes
                                        </label>
                                    </div>

                                    <div class="col-sm-2">
              <span data-repeater-delete class="btn btn-danger btn-sm">
                <span class="glyphicon glyphicon-remove"></span> Delete
              </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-1 col-sm-11">
          <span data-repeater-create class="btn btn-info btn-md">
            <span class="glyphicon glyphicon-plus"></span> Add
          </span>
                            </div>
                        </div>

                        <hr/>

                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-1 col-sm-11">
                            <input type="submit" value="Submit" class="btn btn-primary btn-lg"/>
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
</div>
<div id="footer">
    <div class="container">
        <p class="text-muted">
            Programming Doodles &copy; 2017 Brian Detering
        </p>
    </div>
</div>
<script src="http://briandetering.net//library/jquery-1.11.0.js"></script>
<script src="http://briandetering.net//library/bootstrap-3.1.1-dist/js/bootstrap.js"></script>
<script src="https://cdn.bootcss.com/jquery.repeater/1.2.1/jquery.repeater.js"></script>
<script>
    $(document).ready(function () {
        'use strict';

        $('.repeater-default').repeater();

        $('.repeater-custom-show-hide').repeater({
            show: function () {
                $(this).slideDown();
            },
            hide: function (remove) {
                if (confirm('Are you sure you want to remove this item?')) {
                    $(this).slideUp(remove);
                }
            }
        });

        $('.repeater-default-values').repeater({
            defaultValues: {
                features: ['abs'],
                make: 'ford',
                model: 'Mustang'
            }
        });
    });
</script>
</body>
</html>